program Addybeg;
(*No part of this script may be copied or sold*)
var voidx,voidy,Trades,width,height,offsetx,offsety:integer;
const
Beg='/can anyone please spare a few extra items/? /i got hacked/!';
Procedure ReadString(str: String); {Created by Rena}
var
i,strLength :Integer;
goer: Boolean;

begin
  i:=1
  strLength:=Length(str)
  goer:=False
  while(i<strLength+1) do
    begin
      if(GetKeyCode(StrGet(str,i))=191)then
      begin
        KeyDown(16)
        goer:=True
        i:=i+1
      end;
      KeyDown(GetKeyCode(StrGet(str,i)))
      wait(15)
      KeyUp(GetKeyCode(StrGet(str,i)))
      wait(16)
      i:=i+1
      if(goer=True)then
      begin
        KeyUp(16)
      end;
    end;
    wait(300)
end;

Procedure trade;
  begin
    wait(100);
    clickmouse(325+offsetx,225+offsety,true);
    wait(100);
    begin
      wait(1000);
      clickmouse(80+offsetx,365+offsety,true);
      wait(100);
      clickmouse(135+offsetx,375+offsety,true);
      wait(100);
      clickmouse(440+offsetx,175+offsety,true);
      wait(100);
      clickmouse(300+offsetx,235+offsety,true);
      wait(10000);
      clickmouse(450+offsetx,300+offsety,true);
      wait(1000);
      clickmouse(320+offsetx,220+offsety,true);
      repeat
        wait(100);
      until(getcolor(418+offsetx,226+offsety)=8109518)
      clickmouse(420+offsetx,225+offsety,true);
      Trades:=Trades+1;
    end;
  end;

begin
  getclientdimensions(width,height);
  offsety:=height-506;
  offsetx:=width-641;
  Activateclient;
  Wait(1000);
  Repeat
    If(not(findcolor(voidx,voidy,2183803,200+offsetx,150+offsety,475+offsetx,240+offsety)))then
    begin
      wait(15000);
      readstring(Beg+chr(13));
    end;
    wait(100);
    If(findcolor(voidx,voidy,2183803,200+offsetx,150+offsety,475+offsetx,240+offsety))then
      trade;
      clearreport;
    addtoreport('Traded '+inttostr(Trades)+' Times.');
  Until(false)
end.